﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core.Primitives
{
    [Serializable]
    public struct SinglePoint
    {
        private float m_x;
        public float X
        {
            get { return m_x; }
            set { m_x = value; }
        }

        private float m_y;
        public float Y
        {
            get { return m_y; }
            set { m_y = value; }
        }

        public SinglePoint(float x = 0f, float y = 0f)
        {
            m_x = x;
            m_y = y;
        }

        public static SinglePoint operator +(SinglePoint point1, SinglePoint point2)
        {
            return new SinglePoint(point1.X + point2.X, point1.Y + point2.Y);
        }
        public static SinglePoint operator -(SinglePoint point1, SinglePoint point2)
        {
            return new SinglePoint(point1.X - point2.X, point1.Y - point2.Y);
        }
        public static SinglePoint operator *(SinglePoint point, float multiplier)
        {
            return new SinglePoint(point.X * multiplier, point.Y * multiplier);
        }
        public static SinglePoint operator *(float multiplier, SinglePoint point)
        {
            return point * multiplier;
        }

        public override string ToString()
        {
            return string.Format("({0:F2}, {1:F2})", m_x, m_y);
        }
    }
}
